package com.woniuxy.third.configuration;

import com.woniuxy.third.filter.CrossFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.boot.web.servlet.MultipartConfigFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.util.unit.DataSize;

import javax.servlet.Filter;
import javax.servlet.MultipartConfigElement;

/**
 * @Author: yangtao
 * @date 2021/7/14 10:35
 * @Version 1.0
 */
@Configuration
public class updateimageConfiguration {
    @Bean
    public MultipartConfigElement multipartConfigElement() {
        MultipartConfigFactory factory = new MultipartConfigFactory();

        //factory.setMaxFileSize(1024);
        //单个文件最大
        factory.setMaxFileSize(DataSize.ofKilobytes(10240)); //KB,MB
        /// 设置总上传数据总大小
        factory.setMaxRequestSize(DataSize.ofKilobytes(102400));
        /*factory.setLocation();*/
        return factory.createMultipartConfig();
    }
}














